import request from "@/utils/request";
import {
  ParamsType,
  ProjectAccountStatusForm,
  ProjectAccountExamineForm,
  ProjectSpecialAccountPayment,
  ProjectSpecialAccountPaymentDetails,
  ProjectSpecialAccountPaymentDetailsEditForm,
  ProjectSpecialAccountPaymentEditForm,
} from "./types";

/**
 * 获取专户列表
 */
export function getProjectAccountList(data: ParamsType) {
  return request({
    url: "/api/v1/sysuser/projectspecialaccount/page",
    method: "get",
    params: data,
  });
}

/**
 * 获取专户信息
 */
export function getProjectAccountInfo(id: number) {
  return request({
    url: `api/v1/sysuser/projectspecialaccount/${id}/form`,
    method: "get",
  });
}

/**
 * 审批专户信息
 */
export function examineProjectAccount(
  id: number,
  data: ProjectAccountExamineForm
) {
  return request({
    url: "/api/v1/sysuser/projectspecialaccount/examine/" + id,
    method: "put",
    data: data,
  });
}

/**
 * 修改专户状态专户信息
 */
export function changeProjectAccountStatus(
  id: number,
  data: ProjectAccountStatusForm
) {
  return request({
    url: "/api/v1/sysuser/projectspecialaccount/status/" + id,
    method: "put",
    data: data,
  });
}

/**
 * 获取收支信息列表
 */
export function getProjectAccountPaymentList(data: ParamsType) {
  return request({
    url: "/api/v1/sysuser/projectspecialaccountpayment/page",
    method: "get",
    data: data,
  });
}
/**
 * 创建收支信息
 */
export function createProjectAccountPayment(
  data: ProjectSpecialAccountPaymentEditForm
) {
  return request({
    url: "/api/v1/sysuser/projectspecialaccountpayment/create",
    method: "post",
    data: data,
  });
}
/**
 * 修改收支信息
 */
export function updateProjectAccountPayment(
  id: number,
  data: ProjectSpecialAccountPaymentEditForm
) {
  return request({
    url: "/api/v1/sysuser/projectspecialaccountpayment/" + id,
    method: "put",
    data: data,
  });
}

/**
 * 获取支付明细列表
 */
export function getProjectAccountPaymentDetailsList(data: ParamsType) {
  return request({
    url: "/api/v1/sysuser/projectspecialaccountpaymentdetails/page",
    method: "get",
    data: data,
  });
}
/**
 * 创建支付明细
 */
export function createProjectAccountPaymentDetails(
  data: ProjectSpecialAccountPaymentDetailsEditForm
) {
  return request({
    url: "/api/v1/sysuser/projectspecialaccountpaymentdetails/create",
    method: "post",
    data: data,
  });
}
/**
 * 修改支付明细
 */
export function updateProjectAccountPaymentDetails(
  id: number,
  data: ProjectSpecialAccountPaymentDetailsEditForm
) {
  return request({
    url: "/api/v1/sysuser/projectspecialaccountpaymentdetails/" + id,
    method: "put",
    data: data,
  });
}
